home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
0391B.ZIP
/
JWINDOW.ARC
/
JERWIND.INC
< prev
next >
Wrap
Text File
|
1985-09-15
|
5KB
|
121 lines
{ Program JERWIND.INC Ver 1.2
Author Jerry S. Lamphere - Copyright 1985
208 Highland St.
Fulton NY, 13069
The Purpose of this program was the need to display windows for
error messages, and displaying of Misc. Data without Destroying the
integrity of the main screen being worked. I did not set the program
up to do Multiple windows since most of my applications don't require
the need for it. The only things you may have to change is values that
define each window in Wtab and the number, also if you are using a
Monochrome Card - the address specified in Card_type from $B800:0000
to $B000:0000 since direct addressing is done to the screen memory.
Since this is just the very basics of doing windowing with TURBO
I did not include any routines to save the backround for foreground
colors before opening a window, although it could be done rather easily,
I find it just as easy to restore them myself when I go back to the
original screen. Although there are fancier routines for manipulating
windows and multiple windows, this should meet the needs of most quick
little programs. If you have never done windowing and wondered how some
programs handle it maybe this will give some insight to that end. This
routine is copyrighted since it was part of a major program I did, however
you may freely utilize these procedures in any of your programs. }
Const Wtab :array [1..4,1..6] of integer {4 windows with 6 parameters.}
{ Now we will define all of our window parameters in the array
the first four positions are the where we wish to open the
window, then window border color, followed by the backround
color for the window. }
= (( 10, 3, 70, 20, 5, 7), {Window 1}
( 12, 7, 68, 18, 7, 9), {Window 2}
( 10, 5, 70, 15, 6, 12), {Window 3}
( 15, 6, 65, 20, 3, 0)); {Window 4}
Var Screen_Dat : array [1..25] of String [160]; {Array where we will
store the screen be-
fore opening a window }
Sav_X, Sav_Y,
Wind_open, I : Integer; { Where we store cursor position
also wehter a window is open }
Card_type : Char absolute $B800:0000; {scrn address for color card}
{ This is the start of the procedure to close an existing window
and restore the screen to it's previous self }
Procedure Close_Window;
Begin
Move ( Screen_Dat, Card_type, 4000);
Window (1,1,80,24);
Gotoxy (Sav_X, Sav_Y); { Restore Cursor }
Wind_open := 0;
End;
Procedure Open_Window (Screen : integer);
{ Screen has the array number of the window we want to open }
Var I :Byte;
Begin
If (Wind_open = 1) then
Begin
Textbackground(0); {help eliminate flash when changing windows }
Close_Window; {Have one open so Close it first
to keep a neater scrren }
End;
Move ( Card_type, Screen_Dat, 4000); { Save Screen as is }
Sav_X := WhereX; { Save X location of cursor }
Sav_Y := WhereY; { Save Y location of cursor }
{ Hopefully everything that needed saving is done so let's get going }
Window ( Wtab[Screen,1], Wtab[Screen,2], {Start of window}
Wtab[Screen,3], Wtab[Screen,4] ); {Bottom of window}
Clrscr;
{ Do the window Border colors }
TextColor ( Wtab[Screen,5] ); { Border color }
TextBackground ( Wtab[Screen,6] ); { Background color }
{ Now to frame }
Gotoxy (1,1); Write ('╒');
For I := 2 to Wtab[screen,3] - Wtab[Screen,1] do
Write ('═');
Write ('╕');
For I :=2 to Wtab[Screen,4] - Wtab[Screen,2] do
Begin
Gotoxy (1,I); Write ('│');
Gotoxy (Wtab[screen,3] - Wtab[Screen,1] + 1, I);
Write ('│');
End;
Gotoxy (1, Wtab[Screen,4] - Wtab[Screen,2] + 1); Write ('╘');
For I := 2 to Wtab[Screen,3] - Wtab[Screen,1] do
Write ('═');
{ Write ('╛'); }
{ Since we put a frame around the window better make a new one so
we don't have to worry about writing over the border }
Window (Wtab[screen,1] + 1, Wtab[Screen,2] + 1,
Wtab[Screen,3] - 1, Wtab[Screen,4] - 1 );
Write ('╛');
TextColor (7);
Wind_open := 1;
CLRSCR;
End; { End of procedure to open a window }